import Vue from 'vue'
import Router from 'vue-router'
import HelloWorld from '@/components/HelloWorld'
import Home from '../pages/home/index.vue'
import Shop from '../pages/Shop/index.vue'
import Learn from '../pages/learn/learn.vue'

/* 子页面 */
import Java from '../pages/learn/subpage/java.vue'
import Go from '../pages/learn/subpage/go.vue'

Vue.use(Router);

export default new Router({
  routes: [{
      path: '/',
      redirect: "/home" /* 重定向*/
    }, {
      path: '/',
      name: 'HelloWorld',
      component: HelloWorld
    },
    {
      path: '/home',
      name: 'Home',
      component: Home
    },
    {
      path: '/shop/:id',
      name: "Shop",
      component: Shop,
      props: true
    },
    {
      path: '/learn',
      component: Learn,
      children: [{
          path: 'java',
          component: Java,
          alias: 'javaweb' /* 别名 */
        },
        {
          path: 'go',
          component: Go
        }
      ]
    }
  ]
})
